namespace RFIDData.Models
{
	using System;
	using System.Data.Entity;
	using System.ComponentModel.DataAnnotations.Schema;
	using System.Linq;

	public partial class RFIDDB : DbContext
	{
		public RFIDDB()
			: base("name=RFIDDB")
		{
		}

		public virtual DbSet<Card> Cards { get; set; }
		public virtual DbSet<Commute> Commutes { get; set; }
		public virtual DbSet<Employee> Employees { get; set; }

		protected override void OnModelCreating(DbModelBuilder modelBuilder)
		{
			modelBuilder.Entity<Card>()
				.Property(e => e.CaNo)
				.IsUnicode(false);

			modelBuilder.Entity<Employee>()
				.Property(e => e.Department)
				.IsUnicode(false);

			modelBuilder.Entity<Employee>()
				.Property(e => e.Rank)
				.IsUnicode(false);

			modelBuilder.Entity<Employee>()
				.Property(e => e.Phone)
				.IsUnicode(false);

			modelBuilder.Entity<Employee>()
				.HasMany(e => e.Cards)
				.WithRequired(e => e.Employee)
				.WillCascadeOnDelete(false);

			modelBuilder.Entity<Employee>()
				.HasMany(e => e.Commutes)
				.WithRequired(e => e.Employee)
				.WillCascadeOnDelete(false);
		}
	}
}
